<template>
	<view class="content">
		<!-- logo图片 -->
		<view class="logo">
			<image src="../../static/raw_1516935429.png" mode="" class="logo-img"></image>
		</view>
		<!-- 表单 -->
		<view class="">
			<form>
				<input type="text" class="username" placeholder='请输入姓名' id="usernmae" v-model="usernmae" />
				<input type="password" class="password" placeholder='密码' id="password" v-model="password" />
				<button form-type="submit" @click="Loginsubmit" class="Loginsubmit">微信授权登录</button>
			</form>
			<p class="register" @click='register'>没有账号,免费注册</p>
			<p class="forget" @click='forget'>忘记密码</p>
		</view>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				usernmae: '',
				password: ''
			}
		},
		computed:{
			...mapState(['name']),
		},
		methods: {
			...mapMutations(['setadd']),
			// 跳转注册
			register() {
				uni.navigateTo({
					url: '/pages/register/'
				});
			},
			// 登录
			Loginsubmit() {
				if(this.usernmae==''&&this.password==''){
					console.log('不能为空')
				}else{
					let user = this.usernmae;
					let psd = this.password;
					this.setadd({
						user,
						psd
					})
            // var namea=localStorage.setItem('names', this.usernmae);
					uni.switchTab({
						url: '/pages/Home/index'
					})
				}
			},
			// 忘记密码
			forget() {
				uni.navigateTo({
					url: '/pages/forget/index'
				});
			}

		},

	}
</script>

<style scoped>
	.content {
		padding: 0px 20px;
		position: relative;
	}

	.logo {
		width: 100%;
		display: flex;
		justify-content: center;


	}

	.logo-img {
		width: 130px;
		height: 74px;

	}

	.username,
	.password {
		height: 50px;
		border-bottom: 1px solid #708090;
	}



	.Loginsubmit {
		margin-top: 30px;
		background: #fff;
		font-size: 16px;
		border-radius: 5px;
		margin-bottom: 10px;
	}

	.register {
		width: 109px;
		height: 23px;
		left: 34px;
		top: 349px;
		transform: rotate(0deg);
		-webkit-transform: rotate(0deg);
		font-size: 12.0px;
		padding: 0px;
		border-radius: 0px;
		border-width: 0px;
		border-style: solid;
		line-height: 17px;
		font-weight: normal;
		font-style: normal;
		z-index: 5;
		opacity: 1;
		float: left;
	}

	.forget {
		width: 49px;
		height: 23px;
		left: 293px;
		top: 349px;
		transform: rotate(0deg);
		-webkit-transform: rotate(0deg);
		font-size: 12.0px;
		padding: 0px;
		border-radius: 0px;
		border-width: 0px;
		border-style: solid;
		line-height: 17px;
		font-weight: normal;
		font-style: normal;
		z-index: 5;
		opacity: 1;
		float: right;
		margin-top: 2px;
	}
</style>
